<template>
  <div
    className="content-wrapper"
    style="padding-left: 20px; padding-top: 20px"
  >
    <div className="content-header"></div>
    <div class="title">
      <div>借阅流程({{ this.title }})</div>
      <div class="input" v-if="documentCode">
        <i>文件编号:</i>
        <i>{{ this.documentCode }}</i>
      </div>
    </div>
    <div className="content-container">
      <el-divider></el-divider>
      <FlowData v-on:flowData="flowData" />
    </div>
  </div>
</template>

<script>
import FlowData from '@/views/flow/flow_borrow/flow_data'
import FlowWorkflow from '@/views/flow/flow_borrow/flow_workflow'
import '@/styles/flow.scss'

export default {
  components: {
    FlowData,
    FlowWorkflow
  },
  data() {
    const FLOW_TYPE_BORROW = 5
    const PHASE_APPLY = 1
    const PHASE_CONTENT_AUDIT = 2
    const PHASE_APPROVAL = 3
    const PHASE_RELEASE = 4
    return {
      activeName: 'flow_data',
      flowStatus: '',
      documentCode: '',
      title: '',
      flowStatusOptions: [
        { value: PHASE_APPLY, label: '借阅申请', phase: 'newApply' },
        { value: PHASE_CONTENT_AUDIT, label: '文件审核', phase: 'audit' },
        { value: PHASE_APPROVAL, label: '审批', phase: 'approve' },
        { value: PHASE_RELEASE, label: '发行', phase: 'release' }
      ]
    }
  },
    methods: {
    flowData(data) {
      this.documentCode = data.documentCode
      this.flowStatus = data.flowStatus
      this.title = this.flowStatusOptions[this.flowStatus - 1].label
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
